﻿@model TaxSettingsModel
@{
    //page title
    ViewBag.Title = Loc["Admin.Configuration.Tax.Settings"];
}
<form asp-area="@Constants.AreaAdmin" asp-controller="Tax" asp-action="Settings" method="post">

<div asp-validation-summary="All"></div>
<script>
        $(document).ready(function () {

            $("#@Html.IdFor(model => model.AllowCustomersToSelectTaxDisplayType)").click(toggleTaxDisplayType);
            $("#@Html.IdFor(model => model.ShippingIsTaxable)").click(toggleShipping);
            $("#@Html.IdFor(model => model.PaymentMethodAdditionalFeeIsTaxable)").click(togglePayment);
            $("#@Html.IdFor(model => model.EuVatEnabled)").click(toggleEUVAT);


            toggleTaxDisplayType();
            toggleShipping();
            togglePayment();
            toggleEUVAT();
        });

        function toggleTaxDisplayType() {
            if ($('#@Html.IdFor(model => model.AllowCustomersToSelectTaxDisplayType)').is(':checked')) {
                $('#pnlTaxDisplayType').hide();
            }
            else {
                $('#pnlTaxDisplayType').show();
            }
        }

        function toggleShipping() {
            if ($('#@Html.IdFor(model => model.ShippingIsTaxable)').is(':checked')) {
                $('#pnlShippingPriceIncludesTax').show();
                $('#pnlShippingTaxClass').show();
            }
            else {
                $('#pnlShippingPriceIncludesTax').hide();
                $('#pnlShippingTaxClass').hide();
            }
        }

        function togglePayment() {
            if ($('#@Html.IdFor(model => model.PaymentMethodAdditionalFeeIsTaxable)').is(':checked')) {
                $('#pnlPaymentMethodAdditionalFeeIncludesTax').show();
                $('#pnlPaymentMethodAdditionalFeeTaxCategory').show();
            }
            else {
                $('#pnlPaymentMethodAdditionalFeeIncludesTax').hide();
                $('#pnlPaymentMethodAdditionalFeeTaxCategory').hide();
            }
        }

        function toggleEUVAT() {
            if ($('#@Html.IdFor(model => model.EuVatEnabled)').is(':checked')) {
                $('#pnlEuVatShopCountry').show();
                $('#pnlEuVatAllowVATExemption').show();
                $('#pnlEuVatAssumeValid').show();
                $('#pnlEuVatUseWebService').show();
                $('#pnlEuVatNote').show();
            }
            else {
                $('#pnlEuVatShopCountry').hide();
                $('#pnlEuVatAllowVATExemption').hide();
                $('#pnlEuVatAssumeValid').hide();
                $('#pnlEuVatUseWebService').hide();
                $('#pnlEuVatNote').hide();
            }
        }
    </script>
<div class="row">
<div class="col-md-12">
<div class="x_panel light form-fit">
<div class="x_title">
    <div class="caption">
        <i class="fa fa-fw fa-sliders"></i>
        @Loc["Admin.Configuration.Tax.Settings"]
    </div>
    <div class="actions">
        <div class="btn-group btn-group-devided">
            <button class="btn btn-success" type="submit" name="save">
                <i class="fa fa-check"></i> @Loc["Admin.Common.Save"]
            </button>
        </div>
    </div>
    <vc:admin-widget widget-zone="tax_settings_buttons" additional-data="null"/>
</div>
<div class="x_content">
    <div class="form-horizontal">
        <div class="form-body">
            @await Component.InvokeAsync("StoreScope")
        </div>
    </div>
</div>
<div class="x_content form">
<vc:admin-widget widget-zone="tax_settings_top" additional-data="null"/>
<div class="form-horizontal">
<div class="form-body">
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="PricesIncludeTax" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="PricesIncludeTax"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="PricesIncludeTax"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="AllowCustomersToSelectTaxDisplayType" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="AllowCustomersToSelectTaxDisplayType"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="AllowCustomersToSelectTaxDisplayType"></span>
    </div>
</div>
<div class="form-group" id="pnlTaxDisplayType">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="TaxDisplayType" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <admin-select asp-for="TaxDisplayType" asp-items="Model.TaxDisplayTypeValues"/>
        <span asp-validation-for="TaxDisplayType"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="DisplayTaxRates" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="DisplayTaxRates"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="DisplayTaxRates"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="HideZeroTax" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="HideZeroTax"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="HideZeroTax"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="HideTaxInOrderSummary" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="HideTaxInOrderSummary"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="HideTaxInOrderSummary"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="ForceTaxExclusionFromOrderSubtotal" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="ForceTaxExclusionFromOrderSubtotal"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="ForceTaxExclusionFromOrderSubtotal"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="TaxBasedOn" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <admin-select asp-for="TaxBasedOn" asp-items="Model.TaxBasedOnValues"/>
        <span asp-validation-for="TaxBasedOn"></span>
    </div>
</div>
<div class="form-horizontal portlet light bg-inverse form-fit">
    <div class="form-group" style="padding-top:15px;margin-bottom: 0px;">
        <div class="col-8 col-md-4 col-sm-4 text-right">
            <strong>@Loc["Admin.Configuration.Tax.DefaultTaxAddress"]</strong>
        </div>
    </div>
    <div class="form-group">
        <div id="pnlDefaultTaxAddress">
            <admin-input asp-for="DefaultTaxAddress" asp-template="Address"/>
        </div>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="ShippingIsTaxable" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="ShippingIsTaxable"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="ShippingIsTaxable"></span>
    </div>
</div>
<div class="form-group" id="pnlShippingPriceIncludesTax">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="ShippingPriceIncludesTax" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="ShippingPriceIncludesTax"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="ShippingPriceIncludesTax"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="DefaultTaxCategoryId" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <admin-select asp-for="DefaultTaxCategoryId" asp-items="Model.TaxCategories"/>
        <span asp-validation-for="DefaultTaxCategoryId"></span>
    </div>
</div>
<div class="form-group" id="pnlShippingTaxClass">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="ShippingTaxCategoryId" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <admin-select asp-for="ShippingTaxCategoryId" asp-items="Model.TaxCategories"/>
        <span asp-validation-for="ShippingTaxCategoryId"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="PaymentMethodAdditionalFeeIsTaxable" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="PaymentMethodAdditionalFeeIsTaxable"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="PaymentMethodAdditionalFeeIsTaxable"></span>
    </div>
</div>
<div class="form-group" id="pnlPaymentMethodAdditionalFeeIncludesTax">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="PaymentMethodAdditionalFeeIncludesTax" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="PaymentMethodAdditionalFeeIncludesTax"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="PaymentMethodAdditionalFeeIncludesTax"></span>
    </div>
</div>
<div class="form-group" id="pnlPaymentMethodAdditionalFeeTaxCategory">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="PaymentMethodAdditionalFeeTaxCategoryId" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <admin-select asp-for="PaymentMethodAdditionalFeeTaxCategoryId" asp-items="Model.TaxCategories"/>
        <span asp-validation-for="PaymentMethodAdditionalFeeTaxCategoryId"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="EuVatEnabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="EuVatEnabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="EuVatEnabled"></span>
    </div>
</div>
<div class="form-group" id="pnlEuVatShopCountry">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="EuVatShopCountryId" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <admin-select asp-for="EuVatShopCountryId" asp-items="Model.EuVatShopCountries"/>
        <span asp-validation-for="EuVatShopCountryId"></span>
    </div>
</div>
<div class="form-group" id="pnlEuVatAllowVATExemption">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="EuVatAllowVatExemption" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="EuVatAllowVatExemption"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="EuVatAllowVatExemption"></span>
    </div>
</div>
<div class="form-group" id="pnlEuVatAssumeValid">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="EuVatAssumeValid" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="EuVatAssumeValid"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="EuVatAssumeValid"></span>
    </div>
</div>
<div class="form-group" id="pnlEuVatUseWebService">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="EuVatUseWebService" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="EuVatUseWebService"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="EuVatUseWebService"></span>
    </div>
</div>
<div class="form-group" id="pnlEuVatNote">
    <div class="note note-info">
        If you want to use EU VAT Web Service to validate the EU VAT numbers, please add EuropaCheckVat plugin to your store. It can be found <a href="https://github.com/grandnode/Grand.Plugin.Misc.EuropaCheckVat" target="_blank">here</a>.
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CalculateRoundPrice" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <admin-input asp-for="CalculateRoundPrice"/>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="MidpointRounding" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <admin-select asp-for="MidpointRounding" asp-items="EnumTranslationService.ToSelectList(MidpointRounding.ToEven)"/>
        <span asp-validation-for="MidpointRounding"></span>
    </div>
</div>
</div>
</div>
<vc:admin-widget widget-zone="tax_settings_bottom" additional-data="null"/>
</div>
</div>
</div>
</div>
</form>